home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20020314-20021006
/
000372_fdc@columbia.edu_Wed Sep 18 09:28:28 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2020-01-01
|
5KB
|
166 lines
Article: 13706 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: scripting to a serial sms modem - idiot question!
Date: 18 Sep 2002 09:27:44 -0400
Organization: Columbia University
Lines: 149
Message-ID: <am9v0g$t1e$1@watsol.cc.columbia.edu>
References: <e516d9ec.0209160537.450ca7b@posting.google.com> <am4nq6$p5i$1@watsol.cc.columbia.edu> <e516d9ec.0209180309.320f7dad@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1032355665 25626 128.59.39.139 (18 Sep 2002 13:27:45 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 18 Sep 2002 13:27:45 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13706
In article <e516d9ec.0209180309.320f7dad@posting.google.com>,
Mark Swarbrick <mswarbrick@rentokil.com> wrote:
: ...
: The modem used is a siemens tc35 terminal. SMS commands may vary. I am
: now working on two way scripts so that actions can be performed on the
: pc depending on the text of a message, then a specific message sent
: back. Eg if i text uptime to the sms box, i want a text message back
: with the uptime of the server. Now i've just got to learn some more
: i/o commands!
:
INPUT or MINPUT to get text from the device, OUTPUT to send it, and then
there are myriad string-processing functions to deal with the text.
: There is a website which has two dialogue boxes for number and
: message. This will then write a physical file on the outward facing
: webserver. This file contains the number and message wrapped with the
: correct string
:
: eg lineout at+cmgs"+44123456789"
:
: The internal machine with the sms modem attached runs a script from a
: cron every minute.
:
: -----------
: #!/bin/bash
:
: #runs ftp commands from the ftpget file to get msg file off remote
: webserver
: /bin/cat /tmp/ftpget | /usr/bin/ftp -i -n
:
Of course you can use Kermit for this too:
http://www.columbia.edu/kermit/ftpscripts.html
: #runs another script which appends a header and footer to the message
: file. The #header is just stuff like the kerbang line and setting the
: modem port/speed #etc. The footer is simply a quit statement.
: /tmp/batchscript.sh
:
You can do this with Kermit too. (So in short, the entire process can
be a single Kermit script.)
: #outbox.sms is created which contains the full command list needed to
: send the #sms
: chmod +x /tmp/outbox.sms
:
: #Execute the kermit kebang script
: /tmp/outbox.sms
: echo y|rm /tmp/outbox.sms
: -------------
:
: The final outbox.sms file looks like this:
:
A few minor comments...
: #!/usr/bin/kermit
: set modem type usr
:
Strictly speaking you don't have to tell Kermit what kind of modem
it is, since you never issue a DIAL command.
: set line /dev/ttyS0
:
You need an IF FAILURE clause here in case you can't open the device.
This might be a loop that retries periodically.
: set speed 9600
: set carrier-watch off
: set input echo on
: lineout at
: input 20 ok
:
Here again, you want an IF FAILURE clause to make sure the modem is
paying attention and answering. Also, note that your INPU command
assumes the modem is in verbose response mode, which is not the
only possibility. If you want to be certain, use:
lineout ATQ0V1
Next you have a series of LINOUT and INPUT commands. You can check
each INPUT with IF FAIL, or you can insert:
set take error on
at this point to have the script fail automatically if any subsequent
command fails.
: lineout AT+CMGF=1
: input 20 ok
: lineout AT+CMGS="+447747603208"^M
:
I assume the "^M" here and in the following are mistakes...
: input 20 >^M
: lineout 1^M
: output \26^M
: input 100 ok
: lineout AT+CMGS="+447747603208"^M
: input 20 >^M
: lineout 2^M
: output \26^M
: input 100 ok
: lineout AT+CMGS="+447747603208"^M
: input 20 >^M
: lineout 3^M
: output \26^M
: quit
:
: In this example 3 messages are sent, with the text '1','2','3'
: respectively.
:
Of course this could be done as a loop, with arrays, e.g.:
declare \&m[] = "message one" "message two" "message three"
for \%i \fdim(&m) 1 {
lineout AT+CMGS="+447747603208"
input 20 >
if success {
lineout AT+CMGS="\&m[\%i]"
input 20 >
if success {
output \26
input 100 OK
if success continue
}
}
if > \%i \fdim(&m) exit 0
exit 1 "Message \%i failed: "\&m[\%i]"
: hope this helps someone, let me know what you think frank and if
: you've got any links that might be useful!
:
Maybe some other SMS users will jump in.
As far as Kermit scripting, there is script tutorial and library:
http://www.columbia.edu/kermit/ckscripts.html
The manual:
http://www.columbia.edu/kermit/ck60manual.html
And the C-Kermit 7.0 and 8.0 manual updates:
http://www.columbia.edu/kermit/ckermit70.html
http://www.columbia.edu/kermit/ckermit80.html
- Frank